Nginx : PHP-FPM
2015/08/26 |
Install PHP-FPM ( PHP FastCGI Process Manager ) to use PHP scripts on Nginx.
|
|
[1] | Install PHP and PHP-FPM. |
# install from EPEL [root@www ~]# yum --enablerepo=epel -y install php php-mbstring php-pear php-fpm
|
[2] | Configure PHP-FPM and Nginx. |
[root@www ~]#
vi /etc/php-fpm.d/www.conf # line 39: change user = nginx # line 41: change group = nginx
[root@www ~]#
vi /etc/nginx/nginx.conf # add into "server" section location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; include fastcgi_params; } systemctl restart nginx |
[3] | Create a test page to make sure PHP script works normally. |
[root@www ~]# echo "<?php phpinfo() ?>" > /usr/share/nginx/html/info.php |